package com.blank.web.servlet;

import com.blank.web.bean.ClassBean;
import com.blank.web.service.ClassService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "updateClassServlet",urlPatterns = "/updateClassInfo")
public class updateClassServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int cid = Integer.parseInt(request.getParameter("cid"));
        ClassService classService = new ClassService();
        ClassBean  classBean = classService.findClassByCid(cid);
        request.setAttribute("classBean",classBean);
        request.getRequestDispatcher("updateClassInfo.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request,response);
    }
}
